package com.cole.gx095.entity;

import com.cole.gx095.domain.Extable;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "exwarehouse")
public class Exwarehouse {
    @Transient
    private List<Extable> extable;

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    @Column(name = "Id")
    private int id;
    @Basic
    @Column(name = "EXNum")
    private String exNum;
    @Basic
    @Column(name = "ExDate")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp exDate;
    @Basic
    @CreatedDate
    @Column(name = "createDate")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp createDate;
    /**
     * 自用 报废
     */
    @Basic
    @Column(name = "Type")
    private String type;
    @Basic
    @Column(name = "CreateAdminTrueName")
    private String createAdminTrueName;
    /**
     * 正常0 作废1
     */
    @Basic
    @Column(name = "Status")
    private Integer status;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getExNum() {
        return exNum;
    }

    public void setExNum(String exNum) {
        this.exNum = exNum;
    }

    public Timestamp getExDate() {
        return exDate;
    }

    public void setExDate(Timestamp exDate) {
        this.exDate = exDate;
    }

    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCreateAdminTrueName() {
        return createAdminTrueName;
    }

    public void setCreateAdminTrueName(String createAdminTrueName) {
        this.createAdminTrueName = createAdminTrueName;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Exwarehouse that = (Exwarehouse) o;
        return id == that.id && Objects.equals(exNum, that.exNum) && Objects.equals(exDate, that.exDate) && Objects.equals(createDate, that.createDate) && Objects.equals(type, that.type) && Objects.equals(createAdminTrueName, that.createAdminTrueName) && Objects.equals(status, that.status);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, exNum, exDate, createDate, type, createAdminTrueName, status);
    }

}
